package Operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class ReturnOperation implements Ioperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书");
        System.out.println("输入要还的书");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int size = bookList.getUsedSize();
        for (int i = 0; i < size; i++) {
            Book book = bookList.getBooks(i);
            if(book.getName().equals(name)==true) {
                book.setBorrowed(false);
                break;
            }
        }
        System.out.println("成功归还");
    }
}
